<div class="wrap">
<?php 
 global $wpdb;
  if (!$wpdb)
          require_once('../../../wp-load.php');   
$problem =   stripcslashes($_POST ['comments']);
$name =  $_POST ["name"];
$title =  $_POST ["subject"];
$email =   $_POST ["email"];
$url =   $_POST ["url"];
$isEdit = false;
$id = $_POST ["id_u"];
if(is_numeric ($id)){
$isEdit = true;
$name =   $_POST ["name_u"];
$title =  $_POST ["title_u"];
$email =   $_POST ["email_u"];
$url =   $_POST ["url_u"];
$problem =   stripcslashes($_POST ["problem_u"]);
}

if ($isEdit){
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->prefix}scope  SET title = '%s', problem = '%s', name = '%s', email = '%s', url = '%s' WHERE id = %d", $title, $problem, $name, $email, $url, $id));
}

else {
$wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->prefix}scope (title, problem, name, email, url, date_created) VALUES (%s, %s, %s, %s, %s, NOW())", $title, $problem, $name, $email, $url));

}?>
<br /><br />
<b>Problem <?php if($isEdit) echo 'updated'; else echo 'submitted'; ?> successfully.</b>
<p></p>
<?php if(!$isEdit) { ?>
<a href="javascript: history.go(-1)">Back</a>
<?php }else{ ?>
<a href="tools.php?page=scope/manage_scope.php">Back</a>
<?php } ?>
